class MusicBtn extends eui.Component implements eui.UIComponent {
	public constructor() {
		super();
		this.skinName = "MusicBtnSkin";
	}
	public music_btn_on: egret.Bitmap;
	public music_btn_off;

	protected partAdded(partName: string, instance: any): void {
		super.partAdded(partName, instance);
	}

	protected childrenCreated(): void {
		super.childrenCreated();

		let sound = RES.getRes("trippin_MP3");
		let soundC: egret.SoundChannel = sound.play(0, -1);
		let isplay = false;
		let position;
		this.music_btn_off.alpha = 0;
		this.music_btn_off.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
			if (isplay) {
				this.music_btn_off.alpha = 0;
				this.music_btn_on.alpha = 1;
				soundC = sound.play(position, -1);
			} else {
				position = soundC.position;
				this.music_btn_off.alpha = 1;
				this.music_btn_on.alpha = 0;
				soundC.stop();
			}
			isplay = !isplay
		}, this)


	}

}